﻿using System;
using System.Collections.Generic;
using System.Text;
using Kingdee.BOS.Core.CloudModel.DSPT;
using Kingdee.BOS.Core.CloudModel.Crm;
using Newtonsoft.Json;

namespace MethodSetBus
{
    public class DS_UpMaterimalBus
    {
        public string DSUpMaterimal(DSMaterimalUp materimalUp, ZHYP_MaterialData _MaterialData)
        {
            Up_Materimal _Materimal = new Up_Materimal();
            _Materimal.id = materimalUp.data.id;
            _Materimal.product_type = materimalUp.data.product_type;
            _Materimal.shop_id = _MaterialData.shop_id;
            _Materimal.shop_class_id = materimalUp.data.shop_class_id;
            _Materimal.top_class_id = _MaterialData.top_class_id;
            _Materimal.second_class_id = _MaterialData.second_class_id;
            _Materimal.product_class_id = _MaterialData.product_class_id;
            _Materimal.product_title = _MaterialData.product_title;//materimalUp.data.product_title;
            _Materimal.default_pic = materimalUp.data.default_pic;
            _Materimal.small_pic = materimalUp.data.small_pic;
            _Materimal.big_pic = materimalUp.data.big_pic;
            _Materimal.video_url = materimalUp.data.video_url;
            _Materimal.mkt_price = _MaterialData.mkt_price;
            _Materimal.sale_price = _MaterialData.sale_price;
            _Materimal.costs_price = materimalUp.data.costs_price;
            _Materimal.unitstock = materimalUp.data.unitstock;
            _Materimal.product_info = materimalUp.data.product_info;
            _Materimal.weight = _MaterialData.weight;//materimalUp.data.weight;
            _Materimal.point = materimalUp.data.point;
            _Materimal.views_count = materimalUp.data.views_count;
            _Materimal.sell_count = _MaterialData.sell_count;
            _Materimal.is_grounding = materimalUp.data.is_grounding;
            _Materimal.ordernum = materimalUp.data.ordernum;
            _Materimal.istop = materimalUp.data.istop;
            _Materimal.ishot = materimalUp.data.ishot;
            _Materimal.isnew = materimalUp.data.isnew;
            _Materimal.isgood = materimalUp.data.isgood;
            _Materimal.recommend = materimalUp.data.recommend;
            _Materimal.addtime = materimalUp.data.addtime;
            _Materimal.ship_type = materimalUp.data.ship_type;
            _Materimal.ship_default_price = materimalUp.data.ship_default_price;
            _Materimal.ship_tpl_id = materimalUp.data.ship_tpl_id;
            _Materimal.limit_num = materimalUp.data.limit_num;
            _Materimal.special_user_buy = materimalUp.data.special_user_buy;
            _Materimal.is_assemble = materimalUp.data.is_assemble;
            _Materimal.no_stock_isshow = materimalUp.data.no_stock_isshow;
            _Materimal.delivery_type = materimalUp.data.delivery_type;
            _Materimal.is_del = materimalUp.data.is_del;
            _Materimal.is_pricing = materimalUp.data.is_pricing;
            _Materimal.is_rebate = materimalUp.data.is_rebate;
            _Materimal.is_rebate_admin = materimalUp.data.is_rebate_admin;
            _Materimal.rebate_type = materimalUp.data.rebate_type;
            _Materimal.onerebate = materimalUp.data.onerebate;
            _Materimal.tworebate = materimalUp.data.tworebate;
            _Materimal.threerebate = materimalUp.data.threerebate;
            _Materimal.is_recommend_ratio = materimalUp.data.is_recommend_ratio;
            _Materimal.is_recommend_ratio_admin = materimalUp.data.is_recommend_ratio_admin;
            _Materimal.recommend_ratio_type = materimalUp.data.recommend_ratio_type;
            _Materimal.one_recommend_ratio = materimalUp.data.one_recommend_ratio;
            _Materimal.two_recommend_ratio = materimalUp.data.two_recommend_ratio;
            _Materimal.three_recommend_ratio = materimalUp.data.threerebate;
            _Materimal.limit_type = materimalUp.data.limit_type;
            _Materimal.new_user_buy = materimalUp.data.new_user_buy;
            _Materimal.down_time = materimalUp.data.down_time;
            _Materimal.packing = materimalUp.data.packing;
            _Materimal.supplier_id = _MaterialData.supplier_id;
            _Materimal.is_presell = materimalUp.data.is_presell;
            _Materimal.limit_period = materimalUp.data.limit_period;
            _Materimal.limit_activity = materimalUp.data.limit_activity;
            _Materimal.title_acronym = materimalUp.data.title_acronym;
            _Materimal.manufacture_date = materimalUp.data.manufacture_date;
            _Materimal.expiration_date = materimalUp.data.expiration_date;
            _Materimal.user_purchase_type = materimalUp.data.user_purchase_type;
            _Materimal.ztd_purchase_type = materimalUp.data.ztd_purchase_type;
            _Materimal.yun_product = materimalUp.data.yun_product;
            _Materimal.show_type = materimalUp.data.show_type;
            _Materimal.product_label_id = materimalUp.data.product_label_id;
            _Materimal.cost_price = _MaterialData.cost_price;
            _Materimal.packed = _MaterialData.packed;
            _Materimal.sku_bar_code = _MaterialData.sku_bar_code.Trim();
            _Materimal.sku_bn = materimalUp.data.sku.sku_info[0].sku_bn;
            _Materimal.agency_price = _MaterialData.agency_price;
            _Materimal.buyer_says_title = materimalUp.data.buyer_says_title;
            _Materimal.buyer_says_content = materimalUp.data.buyer_says_content;
            _Materimal.buyer_name = materimalUp.data.buyer_name;
            _Materimal.buyer_pic = materimalUp.data.buyer_pic;
            _Materimal.video_url = materimalUp.data.video_url;
            _Materimal.position = materimalUp.data.sku.sku_info[0].position;

            return JsonConvert.SerializeObject(_Materimal);
        }
    }
}
